package com.songcha.sakura.ui.adapter


import android.os.Bundle
import androidx.fragment.app.*
import com.songcha.sakura.bean.ComicDetailBean
import com.songcha.sakura.mvvm.comic.episode.ComicEpisodeFragment
import com.songcha.sakura.struct.EpisodeListBundleData


class ComicPlayUrlAdapter(fm:FragmentManager,val thumb:String, val titles:ArrayList<String>,val playUrlList:MutableList<MutableList<ComicDetailBean.EpisodeBean>>) : FragmentStatePagerAdapter(fm) {
     override fun getCount(): Int {
        return titles.size
     }

     override fun getItem(position: Int): Fragment {
         val frag= ComicEpisodeFragment()
         val bundle=Bundle()
         bundle.putString("thumb",thumb)
         bundle.putSerializable("episode_list",EpisodeListBundleData(playUrlList[position]))
         frag.arguments=bundle
         return frag
     }

     override fun getPageTitle(position: Int): CharSequence? {
         return titles[position]
     }




 }


